<!DOCTYPE html>
<html>
<head>
    <title>领料单</title>
    #parse("sys/header.html")
</head>
<style>
    ::-webkit-scrollbar{
        width: 10px;
        height: 10px;
    }
    ::-webkit-scrollbar-thumb{
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        background: #a8a5a5;
    }
</style>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-input type="text"  icon="md-arrow-dropdown-circle"
                             readonly="readonly"
                             v-model="workShopShow"
                             @on-click="deptTree" placeholder="请选择设备组织结构"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.materCode" @on-enter="query" placeholder="领料单编号"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.jobCode" @on-enter="query" placeholder="工单编号"></i-input>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.materialType" placeholder="领料类别">
                        <i-option v-for="item in materiaTyppeList" :value="item.value" :key="item.value">{{item.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.progress" placeholder="领料单状态">
                        <i-option v-for="item in materProgress" :value="item.value" :key="item.value">{{item.name}}
                        </i-option>
                    </i-select>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.picker" @on-enter="query" placeholder="领料人"></i-input>
                </i-col>
                <i-col span="3">
                    <Date-picker type="daterange" v-model="repairStartRange" placement="bottom-end"
                                 placeholder="报修时间和维修开始时间区间" @on-change="handleRepairStartRangeChange"></Date-picker>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("spareMater:save"))
                <i-button type="info" @click="commit"><i class="fa fa-plus"></i>&nbsp;提交审核</i-button>
                <i-button type="error" @click="cancel"><i class="fa fa-trash-o"></i>&nbsp;取消领料</i-button>
                #end
                <!--#if($shiro.hasPermission("spareMater:out"))-->
                <!--<i-button type="primary" @click="outMater"><i class="fa fa-plus"></i>出库</i-button>-->
                <!--#end-->
                #if($shiro.hasPermission("spareMater:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("spareMater:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("spareMater:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
<!--                #if($shiro.hasPermission("spareMater:delete"))-->
<!--                <i-button type="warning"  @click="invalid"><i class="fa fa-pencil-square-o"></i>无效</i-button>-->
<!--                #end-->
                #if($shiro.hasPermission("spareMater:troubleshooting"))
                <i-button type="error"  @click="troubleshooting"><i class="fa fa-trash-o"></i>故障单据处理</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="materialBase" :rules="ruleValidate" :label-width="80">
            <Row>
                <i-col span="11">
                    <Form-item label="领料类别" prop="jobCode">
                        <i-select v-model="materialBase.materialType" placeholder="领料类别">
                            <i-option v-for="item in materTypes" :value="item.value" :key="item.value" :disabled="item.value==4">{{item.name}}</i-option>
                        </i-select>
                    </Form-item>
                </i-col>
            </Row>
            <Row v-show="materialBase.materialType == 1">
                <i-col span="11">
                    <Form-item label="产线">
                        <i-input v-model="line" placeholder="线边库时必填" @on-click="loadLineList" readonly icon="md-arrow-dropdown-circle"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row v-show="materialBase.materialType == 2">
                <i-col span="11">
                    <Form-item label="维修工单号" prop="jobCode">
                        <i-input v-model="materialBase.jobCode" placeholder="维修领料时必填" @on-click="getRepairJobCodeSelect" readonly icon="md-arrow-dropdown-circle"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row v-show="materialBase.materialType == 3">
                <i-col span="11">
                    <Form-item label="维护工单号" prop="jobCode">
                        <i-input v-model="materialBase.jobCode" placeholder="维护领料时必填" @on-click="getMaintenanceJobCodeSelect" readonly icon="md-arrow-dropdown-circle"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="用途" prop="purpose">
                        <i-input type="textarea" v-model="materialBase.purpose" placeholder="请输入领料用途"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="备注信息" prop="remark">
                        <i-input type="textarea" v-model="materialBase.remark" placeholder="备注信息"/>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审批人员列表 -->
    <div id="audit" style="display: none;padding:20px;">
        <i-form>
            <Form-item label="审批人员" prop="repairUser">
                <i-col span="11">
                    <i-select v-model="approveParam.approverId" class="form-input">
                        <i-option v-for="approver in approverList" :value="approver.userId" :key="approver.userId">
                            {{approver.nickName}}
                        </i-option>
                    </i-select>
                </i-col>
            </Form-item>
        </i-form>
    </div>
    <!-- 审核列表区域 -->
    <div id="auditHistoryArea" style="display: none;">
        <i-table border :columns="auditTableColumns" :data="auditTableData"></i-table>
    </div>
    <div id="workShopSubmit" class="treeContent" style="display: none;padding:10px;">
        <ul id="storeTree" class="ztree"></ul>
    </div>
</div>
<!-- 产线列表 -->
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>
<script src="${rc.contextPath}/js/spare/sparematerialbase.js?_${date.systemTime}"></script>
</body>
</html>
